﻿using DG.Tweening;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class NormalCubeBehaviour : MonoBehaviour
{
    HashSet<Collider> fallCubes = new HashSet<Collider>();

    // Start is called before the first frame update
    void Start()
    {
        Player.Instance.onFootTriggerEnter.AddListener(collider => 
        {
            if (collider.tag == "Normal Cube")
            {
                if (fallCubes.Contains(collider))
                {
                    return;
                }
                Global.money -= 20;
                fallCubes.Add(collider);
                collider.transform.DOMoveY(-15, 6).SetEase(Ease.InCubic).onComplete += () =>
                {
                    Destroy(collider.gameObject);
                };
            }
        });
    }

    // Update is called once per frame
    void Update()
    {
        
    }
}
